<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="./login/login.css/login.css">
</head>

<body>
    <h1 class="logo">欢迎使用 客户关系管理系统</h1>
    <div class="home">
        <p>登 录</p>
        <form action="#">
            <input type="text" id="name" placeholder="用户名:111"></br>
            <input type="text" id="password" placeholder="密码:111"></br>
            <div id="obj">√</div>
        </form>
    </div>
    <script src="./login/login.js/jQuery.js"></script>
    <script src="./login/login.js/layui/layui.js"></script>
    <script type="text/javascript">
        document.getElementById('name').focus();

        //用户账号
        let users = [
            { 'name': '111', 'pwd': '111' },
            { 'name': '222', 'pwd': '222' },
            { 'name': '333', 'pwd': '333' }
        ];
        let loginUser = -1;
        let nameNub = document.getElementById('name');
        let pwdNub = document.getElementById('password');
        let btn = document.getElementById('obj');
        login();
        function login() {
            btn.onclick = function () {
                for (let i = 0; i < users.length; i++) {
                    if (nameNub.value == users[i].name && pwdNub.value == users[i].pwd) {
                        window.location.href = "./index.html";
                        break;
                    } else {
                        layer.msg('账号错误');
                        nameNub.value = '';
                        pwdNub.value = '';
                        break;
                    }
                }

            }
        }
    </script>
</body>

</html>